#ifndef __MY_EMS_H__
#define __MY_EMS_H__

#include "n32l40x.h"

typedef enum{

    EMS_100HZ_FREQ = 0,
    EMS_500HZ_FREQ,
    EMS_1KHZ_FREQ,
    EMS_2KHZ_FREQ,
    EMS_3KHZ_FREQ,
    EMS_4KHZ_FREQ,

    EMS_9KHZ_FREQ,
    EMS_12KHZ_FREQ,
    EMS_15KHZ_FREQ,

}EMS_FREQ_e;

typedef enum{
    EMS_DEFAULT_DUTY = 0,
    EMS_LITTLE_DUTY,
    EMS_MIDDLE_DUTY,
    EMS_LARGE_DUTY,
    EMS_MAX_DUTY,


}EMS_DUTY_LEVEL_e;


#define DUYT_OFFSET (5)

typedef enum{

    EMS_100HZ_DEFAULT_DUTY = 5,
    EMS_100HZ_LITTLE_DUTY = 2,
    EMS_100HZ_MIDDLE_DUTY = 3,
    EMS_100HZ_LARGE_DUTY = 5,

    // EMS_500HZ_DEFAULT_DUTY = 8,
    // EMS_500HZ_LITTLE_DUTY = 4,
    // EMS_500HZ_MIDDLE_DUTY = 6,
    // EMS_500HZ_LARGE_DUTY = 8,
    // -----2024 11 04 增强体感
    EMS_500HZ_DEFAULT_DUTY = 8+DUYT_OFFSET,
    EMS_500HZ_LITTLE_DUTY = 4+DUYT_OFFSET,
    EMS_500HZ_MIDDLE_DUTY = 6+DUYT_OFFSET,
    EMS_500HZ_LARGE_DUTY = 8+DUYT_OFFSET,

     
    EMS_1KHZ_DEFAULT_DUTY = 12,
    EMS_1KHZ_LITTLE_DUTY = 8,
    EMS_1KHZ_MIDDLE_DUTY = 10,
    EMS_1KHZ_LARGE_DUTY = 12,

    EMS_2KHZ_DEFAULT_DUTY = 15+DUYT_OFFSET,
    EMS_2KHZ_LITTLE_DUTY = 10+DUYT_OFFSET,
    EMS_2KHZ_MIDDLE_DUTY = 12+DUYT_OFFSET,
    EMS_2KHZ_LARGE_DUTY = 15+DUYT_OFFSET,

    EMS_3KHZ_DEFAULT_DUTY = 15+DUYT_OFFSET + 5,     //15   ------对应占空比为 *2，
    EMS_3KHZ_LITTLE_DUTY = 10+DUYT_OFFSET + 5,      // 10
    EMS_3KHZ_MIDDLE_DUTY = 12+DUYT_OFFSET+5,      // 12
    EMS_3KHZ_LARGE_DUTY = 15+DUYT_OFFSET + 5,

    EMS_4KHZ_DEFAULT_DUTY = 15+DUYT_OFFSET + 8,
    EMS_4KHZ_LITTLE_DUTY = 10+DUYT_OFFSET + 8,
    EMS_4KHZ_MIDDLE_DUTY = 12+DUYT_OFFSET + 8,
    EMS_4KHZ_LARGE_DUTY = 15+DUYT_OFFSET + 8,

    EMS_9KHZ_DEFALUT_DUTY = 18+DUYT_OFFSET +5,
    EMS_9KHZ_LITTLE_DUTY = 12+DUYT_OFFSET +5,
    EMS_9KHZ_MIDDLE_DUTY = 15+DUYT_OFFSET+ 5,
    EMS_9KHZ_LARGE_DUTY = 18+DUYT_OFFSET +5,

    EMS_12KHZ_DEFAULT_DUTY = 20,
    EMS_12KHZ_LITTLE_DUTY = 12,
    EMS_12KHZ_MIDDLE_DUTY = 15,
    EMS_12KHZ_LARGE_DUTY = 20,

    EMS_15KHZ_DEFAULT_DUTY = 25,
    EMS_15KHZ_LITTLE_DUTY = 15,
    EMS_15KHZ_MIDDLE_DUTY = 20,
    EMS_15KHZ_LARGE_DUTY = 25,


}EMS_FREQ_DUTY_e;




void ems_playlod1_stop(void);
void ems_playlod1_restar(void);
void ems_playlod1_restar_with_duty(int duty);

void ems_playlod2_stop(void);
void ems_playlod2_restar(void);
void ems_playlod2_restar_with_duty(int duty);

void ems_freq_select_100hz(EMS_DUTY_LEVEL_e duty_level);
void ems_freq_select_500hz(EMS_DUTY_LEVEL_e duty_level);
void ems_freq_select_1khz(EMS_DUTY_LEVEL_e duty_level);
void ems_freq_select_2khz(EMS_DUTY_LEVEL_e duty_level);
void ems_freq_select_3khz(EMS_DUTY_LEVEL_e duty_level);
void ems_freq_select_4khz(EMS_DUTY_LEVEL_e duty_level);

void ems_freq_select_9khz(EMS_DUTY_LEVEL_e duty_level);
void ems_freq_select_12khz(EMS_DUTY_LEVEL_e duty_level);
void ems_freq_select_15khz(EMS_DUTY_LEVEL_e duty_level);

void my_ems_init(void);

#endif
